GBML manual / Backgrounds

Background actors

A big picture on the turning background layer that code moves, scales and turns like an object, with sprites pinned to named points of it - for a boss too big for sprites.

A picture that acts like an object

Sprites are small, and a boss four times the height of the player would cost dozens of them. A Background Actor is the other way: one big picture on the console's turning background layer (the zoomable background). The console draws it, so it costs the game almost nothing, and code moves it, makes it bigger or smaller and turns it, the way it would an object. Sprites for the parts that move on their own (an arm, a glowing weak spot) are pinned to named points of the picture and stay on them through every move, scale and turn.

It is the room's zoomable background, steered in room numbers instead of screen numbers, so it scrolls with the camera and shakes with camera_shake.

Making one

  1. Draw the picture as a zoomable background in the Paint tab: square, 128, 256, 512 or 1024 pixels, 8 bits a pixel.
  2. In the Paint tab's Actor picture section, tick This is an actor picture. The section shows two gauges: the picture's tiles (at most 256 different 8x8 tiles) and its colors (at most 144). A picture over either limit is refused when the game is built, with a message that says which.
  3. Add pins: click the picture to put a named point on it (mouth, heart, pustule 1).
  4. Make the picture the Zoomable background of a room in Room Properties.

Steering it

CallWhat it does
actor_anchor(u, v)the picture point it stands, grows and turns about
actor_place(x, y)where in the room that point stands
actor_scale(scale)how big, about the anchor
actor_angle(degrees)how far turned, about the anchor, counter-clockwise
actor_visible(yes)shows or hides it
actor_picture("name")swaps in another actor picture (a boss's next phase)
actor_pin_x("pin") and actor_pin_y("pin")where a pin is in the room now
actor_cycle(first, count, frames)a pulse of light along a run of the picture's colors

The limits

Example

// Step event of the boss: sway, lean and rock, with a sprite on her mouth.
actor_anchor(256, 400);
actor_place(240, 97);
actor_scale(1 + 0.2 * angle_sin(frame_count * 2));
actor_angle(10 * angle_sin(frame_count * 2));
See also: Zoomable backgroundsactor_placeactor_anchoractor_scaleactor_angleactor_visibleactor_pictureactor_pin_xactor_pin_yactor_cyclecamera_shake